function [tcs_, attributes_, batchMethods_] = dXtc(num_objects)
% function [tcs_, attributes_, batchMethods_] = dXtc(num_objects)
%
% Constructor method for class dXtc (tuning curve)
%
% dXtc instances cooperate, act as one thing.  Interface with dXtc(1).
%
% Arguments:
%   num_objects   ... number of objects to create
%
% Returns:
%   tcs_          ... array of created tcs
%   attributes_   ... default object attributes
%   batchMethods_ ...

% Copyright 2005 by Joshua I. Gold
%   University of Pennsylvania

% default object attributes
attributes = { ...
    % name              type		ranges(?)	default
    'name',             'scalar',   [],         []; 	...
    'values',           'scalar',   [],         [];     ...
    'ptr',              'cell',     [],         [];     ...
    'override',         'scalar',   [],         [];     ...
    'stairStart',       'scalar',   [],         [];     ...
    'stairUp',          'scalar',   [],         [];     ...
    'stairDown',        'scalar',   [],         [];     ...
    'ptrType',          'auto',     [],         [];     ...
    'ptrClass',         'auto',     [],         [];     ...    
    'ptrIndex',         'auto',     [],         [];     ...
    'lastOutcome',      'auto',     [],         [];     ...
    'outcomeRun',       'auto',     [],         [];     ...
    'value',            'auto',     [],         nan;    ...
    'previousValue',    'auto',     [],         nan;    ...
    'indices',          'auto',     [],         [];     ...
    'indicesOrder',     'auto',     [],         [];     ...
    'indicesBlocks',    'auto',     [],         nan;    ...    
    'index',            'auto',     [],         nan;    ...
    'tc',               'auto',     [],         []};

% tags are numeric array, make struct from defaults
sl = cell2struct(attributes(:,4), attributes(:,1), 1);
for i = 1:num_objects
    tcs_(i) = class(sl, 'dXtc');
end

% It returns the attributes.  It does this whenever it is asked.
if nargout > 1
    attributes_ = attributes;
end

% It returns a list of batch methods.  It does this whenever it is asked.
if nargout > 2
    batchMethods_ = {'control', 'update', 'endTrial', 'saveToFIRA'};
end